﻿using GalaSoft.MvvmLight;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Text;

namespace JiveMessenger.ViewModels
{
    [DataContract]
    public class ViewModelTab : ViewModelBaseEx
    {
        private string _viewModelName;
        [DataMember]
        public string ViewModelName
        {
            get { return _viewModelName; }
            set
            {
                if (_viewModelName != value)
                {
                    Set(() => ViewModelName, ref _viewModelName, value);
                }
            }
        }
        private int _tabNumber;
        public int TabNumber
        {
            get { return _tabNumber; }
            set
            {
                if (_tabNumber != value)
                {
                    Set(() => TabNumber, ref _tabNumber, value);
                }
            }
        }



        private string _id;
        [DataMember]
        public string ID
        {
            get
            {
                return _id;
            }
            set
            {
                if (_id != value)
                {
                    Set(() => ID, ref _id, value);
                }
            }
        }

        private bool _isBlinking;
        public bool IsBlinking
        {
            get { return _isBlinking; }
            set
            {
                if (_isBlinking != value)
                {
                    Set(() => IsBlinking, ref _isBlinking, value);
                }
            }
        }

        private bool _isPinned;
        [DataMember]
        public bool IsPinned
        {
            get { return _isPinned; }
            set
            {
                if (_isPinned != value)
                {
                    Set(() => IsPinned, ref _isPinned, value);
                }
            }
        }

        private bool _isCurrentActiveTab;
        public bool IsCurrentActiveTab
        {
            get { return _isCurrentActiveTab; }
            set
            {
                if (_isCurrentActiveTab != value)
                {
                    Set(() => IsCurrentActiveTab, ref _isCurrentActiveTab, value);
                }
            }
        }
        private bool _showAsTab;
        public bool ShowAsTab
        {
            get { return _showAsTab; }
            set
            {
                if (_showAsTab != value)
                {
                    Set(() => ShowAsTab, ref _showAsTab, value);
                }
            }
        }
        public ViewModelTab(string id, string name)
        {
            this.ID = id;
            this.ViewModelName = name;
            ShowAsTab = true;
        }
        public ViewModelTab()
        {
            ShowAsTab = true;
        }
        [OnDeserialized]
        internal void Initialize(StreamingContext context)
        {
            ShowAsTab = true;
        }
    }
}
